package dimension.starry.Tasks;

import dimension.starry.player.MagicRecover;
import dimension.starry.player.WaterDecrease;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;

import java.util.Vector;

/**
 * @author 150149
 */
public class PlayerTaskManager {

    private static final Vector<PlayerTask> playerTaskList = new Vector<>() {{
        add(MagicRecover.getMagicRecoverTask());
        add(WaterDecrease.getWaterDecreaseTask());
    }};

    public static void onServerStarted(MinecraftServer server) {
        playerTaskList.forEach(task -> TaskManager.addTask(() -> server.getPlayerManager().getPlayerList().forEach(task::run)));
    }

    public interface PlayerTask {
        void run(ServerPlayerEntity playerEntity);
    }

}
